#include <stdio.h>

#define LEN 6965
#define BOUND 20161
int isAbundantNo(int n)
{
	if (n<12) return 0;
	int sum = 1, i, j, pow, org = n;
	for (i = 2; i<=n; i++) {
		pow = 1;
		while(n%i == 0 && n!=0) {
			n/=i;
			pow *=i;
		}
		if (pow != 1)sum = sum*(pow*i-1)/(i-1);
	} 
	sum -= org;
	if (sum > org) return 1;
	else return 0;
}

int isSumOf2AbundantNo(int n, int *a)
{
	int i;
	for (i=0; i<LEN; i++) {
		if (n<a[i])break;
		if (isAbundantNo(n-a[i]))return 1;
	}
	return 0;
}

int main()
{
	int i, j, sum = (BOUND+1)*BOUND/2, num = 0;
	int array[LEN];
	for (i=12, j=0; i<=BOUND; i++) {
		if (isAbundantNo(i)) {
			array[j]= i;
			j++;
			printf("%d ", i);
		}
	}
	sum = 276;
	for (i=24, j=0; i<=BOUND; i++, j++) {
		if (!isSumOf2AbundantNo(i, array)) {
			sum += i;
			//printf("%d ", i);
		}
	}
	printf("\n%d\n", sum);
}
